<template>
  <el-form-item prop="pngStartId" label="第一张图片">
    <el-select v-model="optionModel.pngStartId" placeholder="Select" style="width: 240px">
      <el-option
        v-for="item in imageList"
        :key="item.name"
        :label="item.name"
        :value="item.name"
        class="pngId-option"
      >
        <span style="float: left">{{ item.name }}</span>
        <el-image :src="item.url" style="width: 100px; height: 100px" />
      </el-option>
    </el-select>
  </el-form-item>
</template>

<script>
import { GET_IMAGE_RESOURCE_LIST, GET_IMAGE_RESOURCE_LIST_RESULT } from '@/designer/event'

export default {
  name: 'PngStartIdEditor',
  props: {
    designer: Object,
    selectedWidget: Object,
    optionModel: Object
  },
  data() {
    return {
      imageList: []
    }
  },
  computed: {},
  mounted() {
    this.$emitter.on(GET_IMAGE_RESOURCE_LIST_RESULT, (list) => {
      this.imageList = list
    })
    this.$emitter.emit(GET_IMAGE_RESOURCE_LIST)
  }
}
</script>

<style lang="scss">
.pngId-option {
  height: 120px;
  line-height: 120px;
}
</style>
